<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="{{domain}}/resource/admin/mini/lib/layui-v2.5.5/css/layui.css" media="all">
</head>

<body style="background-color: #dddddd;"><br>


    <div class="layui-container">
        <div class="layui-row">
            <div class="layui-col-md3">&nbsp;</div>
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header">系统文件总览 - 双击可在 Coder 中打开文件</div>
                    <div class="layui-card-body">
                        <div id="trees">内容加载中...</div>
                    </div>
                </div>
            </div>
            <div class="layui-col-md3">&nbsp;</div>
        </div>
    </div>


    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script src="{{domain}}/resource/admin/mini/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
    <script>
        layui.use('tree', function () {
            var tree = layui.tree;

            $.get('{{domain}}/admin/api/summit/folders?from=coder-administator', function (data) {
                //渲染
                var ftree = tree.render({
                    elem: '#trees',
                    accordion: true,
                    data: data.data,
                    click: function (obj) {

                        // 检测是文件夹还是文件
                        if (!obj.data.hasOwnProperty('children')) {
                            var filename = obj.data.title;
                            var parentwin = parent.layer.getFrameIndex(window.name);
                            window.parent.ovOpen(obj.data.title, obj.data.path);
                        }
                    }
                });
            });

        });
    </script>
</body>

</html>